var t = require("../../../@babel/runtime/helpers/interopRequireDefault").default,
  a = require("../../../utils/http"),
  e = t(require("../../../utils/util")),
  n = new a.HTTP;
Page({
  data: {
    room: !0,
    timer: !1,
    timers: !1,
    currentDate: (new Date).getTime(),
    minDate: new Date(2015, 0, 1).getTime(),
    formatter: function (t, a) {
      return "year" === t ? "".concat(a, "年") : "month" === t ? "".concat(a, "月") : a
    }
  },
  onInput: function (t) {
    this.setData({
      currentDate: t.detail
    })
  },
  quxiao: function () {
    wx.navigateBack({
      delta: 1
    })
  },
  onConfirms: function (t) {
    var a = e.default.formatStamp(t.detail);
    this.setData({
      timer: !1,
      htks: a
    })
  },
  onCancels: function () {
    this.setData({
      timer: !1,
      timers: !1
    })
  },
  onConfirmss: function (t) {
    var a = e.default.formatStamp(t.detail);
    this.setData({
      timers: !1,
      htdq: a
    })
  },
  formSubmit: function (t) {
    var a = this;
    wx.showModal({
      title: "提示",
      content: "请核对数据是否确定修改",
      success: function (e) {
        if (e.confirm)
          if (1 == a.data.room)
            n.request({
              url: "https://www.qlsyyun.com:3000/pass",
              header: {
                "Content-Type": "application/x-www-form-urlencoded"
              },
              method: "POST",
              data: {
                fz: t.detail.value.fangzu,
                bz: t.detail.value.zhuangxiu,
                ymj: t.detail.value.mianji,
                wy: t.detail.value.wuye,
                cID: a.data.cID
              }
            }).then((function (t) {
              var a = getCurrentPages(),
                e = a[a.length - 2],
                n = t.data;
              e.setData({
                  detail: n
                }),
                wx.navigateBack({
                  delta: 1
                })
            }));
          else {
            var i = new Date(parseInt((new Date).getTime())).toLocaleString().replace(/:\d{1,2}$/, " ").slice(0, 10);
            n.request({
              url: "https://www.qlsyyun.com:3000/rentNow",
              header: {
                "Content-Type": "application/x-www-form-urlencoded"
              },
              method: "POST",
              data: {
                fjh: t.detail.value.fangjh,
                fjbh: t.detail.value.fangjbh,
                ymj: t.detail.value.zaitmj,
                fz: t.detail.value.fangjzj,
                wy: t.detail.value.wuyf,
                htks: t.detail.value.kaisrq,
                htdq: t.detail.value.daoqrq,
                rzrq: i,
                qymc: t.detail.value.qiymc,
                zsy: t.detail.value.zhaosy,
                bm: t.detail.value.bum,
                lxr: t.detail.value.lianxr,
                lxdh: t.detail.value.dianh,
                hylb: t.detail.value.leib,
                zclx: t.detail.value.leix,
                bz: t.detail.value.bz,
                cID: a.data.cID,
                gxname: a.data.jname,
                gxsj: a.data.time
              }
            }).then((function (t) {
              n.request({
                url: "https://www.qlsyyun.com:3000/sendstmx",
                header: {
                  "Content-Type": "application/x-www-form-urlencoded"
                },
                method: "POST",
                data: {
                  qymc: a.data.qymc,
                  zsy: a.data.zsy,
                  bm: a.data.bm,
                  cID: a.data.cID,
                  tjsj: e,
                  lb: "更新载体信息",
                  tname: a.data.jname
                }
              }).then((function (t) {}));
              var e = Date.parse(new Date).toString().substr(0, 10),
                i = getCurrentPages(),
                l = i[i.length - 2],
                r = t.data;
              l.setData({
                  detail: r
                }),
                wx.navigateBack({
                  delta: 1
                })
            }))
          }
        else
          e.cancel && console.log("用户点击取消")
      }
    })
  },
  fzInput: function () {
    this.setData({
      fz: ""
    })
  },
  ksInput: function () {
    var t = this.data.htks,
      a = Date.parse(t);
    this.setData({
      timer: !0,
      currentDate: a
    })
  },
  htdqInput: function () {
    var t = this.data.htdq,
      a = Date.parse(t);
    this.setData({
      timers: !0,
      currentDate: a
    })
  },
  onLoad: function (t) {
    var a = wx.getStorageSync("redact"),
      e = wx.getStorageSync("user"),
      n = a.rzrq,
      i = a.htks;
    this.setData({
        jname: e[0],
        zt: a.zt,
        lc: a.lc,
        fz: a.fz,
        cID: a.ycID,
        fjh: a.fjh,
        fjbh: a.fjbh,
        ymj: a.ymj,
        wy: a.wy,
        htks: a.htks,
        htdq: a.htdq,
        rzrq: n,
        qymc: a.qymc,
        zsy: a.zsy,
        bm: a.bm,
        lxr: a.lxr,
        lxdh: a.lxdh,
        hylb: a.hylb,
        zclx: a.zclx,
        bz: a.bz,
        time: i
      }),
      "空房" == a.czzk ? this.setData({
        room: !0
      }) : this.setData({
        room: !1
      })
  }
});